﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using Bymed.SpineScan.DataModel;
using Bymed.SpineScan.Service.Shared;
using Bymed.SpineScan.WPF.Model;
using Bymed.SpineScan.WPF.Shared;
using Bymed.SpineScan.WPF.ViewModel.TestItemViewModel;

namespace Bymed.SpineScan.WPF.ViewModel
{
    /// <summary>
    /// This class contains properties that a View can data bind to.
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class SingleTestDetailViewModel : SingleTestHistoryDataViewModel
    {
        /// <summary>
        /// Initializes a new instance of the SingleTestDetailViewModel class.
        /// </summary>
        public SingleTestDetailViewModel(IDataService dataService)
            : base(dataService) { }

        /// <summary>
        /// Load history data for data binding.
        /// </summary>
        public override void LoadHistoryData(SingleTestItemViewModel testItem)
        {
            base.LoadHistoryData(testItem);

            var data = ViewModelHelper.LoadTestResultData(ServiceFactory.CreateTestTrackingService(), testItem,
                PatientBasicInfoDisplayViewModel.Number, null);

            HistoryAnalysisChartSource = new ObservableCollection<SingleTestItemViewModel>(data.Take(5));
            HistoryDataList = new ObservableCollection<SingleTestItemViewModel>(data);
        }
    }
}